de.ueberdosis.mp3info
Class ID3Reader

java.lang.Object
  |
  +--de.ueberdosis.mp3info.ID3Reader
All Implemented Interfaces:
Defines
Direct Known Subclasses:
id3

public class ID3Reader
extends java.lang.Object
implements Defines

ID 3 version 1.6.0 and Bitrate reader Milon Krejca , Florian Heer , (c) 2000


Field Summary
protected static de.ueberdosis.mp3info.id3v2.ID3V2Tag v2tag
           
protected  de.ueberdosis.mp3info.ExtendedID3Tag xtag
          stores one extended Tag.
 
Fields inherited from interface de.ueberdosis.mp3info.Defines
DEFAULT_ENCODING, ID3V2_FOOTER_SIZE, ID3V2_FRAME_HEADER_SIZE, ID3V2_HEADER_SIZE, ID3V2_X_HEADER_SIZE, MP3_FRAME_HEADER_SIZE, SUPPORTED_NUMBER_OF_EXTENDED_FLAG_BYTES, testPositions, VERSION
 
Constructor Summary
ID3Reader(java.lang.String filename)
           
 
Method Summary
 void checkAllFrames(java.io.RandomAccessFile in)
          Reads all frames sequentially.
 boolean checkVBR(java.io.RandomAccessFile raf)
          Checks a file for encoding with variable bitrate.
 de.ueberdosis.mp3info.ExtendedID3Tag getExtendedID3Tag()
          gives you the parsed tag
static de.ueberdosis.mp3info.id3v2.ID3V2Tag getV2Tag()
          Gives you the last encountered ID3V2Tag.
static void main(java.lang.String[] args)
           
static de.ueberdosis.mp3info.ExtendedID3Tag readExtendedTag(java.io.RandomAccessFile in)
          reads an extended ID3Tag from the given file.
static de.ueberdosis.mp3info.ID3Tag readTag(java.io.RandomAccessFile in)
          This reads an ID3V1Tag from the given File.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xtag

protected de.ueberdosis.mp3info.ExtendedID3Tag xtag
stores one extended Tag. Relict from the days I only had V1 tags to worry about


v2tag

protected static de.ueberdosis.mp3info.id3v2.ID3V2Tag v2tag
Constructor Detail

ID3Reader

public ID3Reader(java.lang.String filename)
          throws java.io.IOException
Method Detail

readTag

public static de.ueberdosis.mp3info.ID3Tag readTag(java.io.RandomAccessFile in)
                                            throws java.io.IOException
This reads an ID3V1Tag from the given File.

java.io.IOException

readExtendedTag

public static de.ueberdosis.mp3info.ExtendedID3Tag readExtendedTag(java.io.RandomAccessFile in)
                                                            throws java.io.IOException
reads an extended ID3Tag from the given file. Apart from things like artist and title, also bitrate and mpegID are read.
This method just reads the first frame it can find. VBR-files definitely result in wrong playing times, as the bitrate is VARIABLE.
To get reliable information on VBR-files checkAllFrames () must be called afterwards!

java.io.IOException

getExtendedID3Tag

public de.ueberdosis.mp3info.ExtendedID3Tag getExtendedID3Tag()
gives you the parsed tag


getV2Tag

public static de.ueberdosis.mp3info.id3v2.ID3V2Tag getV2Tag()
Gives you the last encountered ID3V2Tag. The tag gets nulled everytime a method is called that could encounter a V2 tag (e.g. checkAllFrames, readExtendedTag...)
This is primarily for developers that call the methods defined in Version 1.5. The information flow will change a bit soon.

Returns:
a tag or null

checkVBR

public boolean checkVBR(java.io.RandomAccessFile raf)
                 throws java.io.IOException
Checks a file for encoding with variable bitrate. The positions at which a possible frameheader is looked for are defined in Defines.java. They are always relative to possibly encountered V2-tags.

Returns:
true if the file is VBR. false, if this method only encountered frames with the same bitrates. This is not a definitive check, only a high possibility check!
java.io.IOException

checkAllFrames

public void checkAllFrames(java.io.RandomAccessFile in)
                    throws java.io.IOException
Reads all frames sequentially. It counts the frames and computes the playing time of a file.

Caution: this method is not supposed to be public. It is so only at this time of development and may be altered in the next release!

Since 1.6.0d2 this has to be called only if

If you have a fixed bitrate file (@see checkVBR ()) and you are sure the file contains (apart from an ID3v1 tag) only musical data, you do not need to call this time consuming method.

Parameters:
in - the file to be examined.
java.io.IOException

main

public static void main(java.lang.String[] args)